#编译c文件
#SRC = $(wildcard *.c)
#OBJ = $(SRC: .c = .o)
#BIN = code
#CC = gcc
#FLAG = -o
#CFLAG = -c
#
#$(BIN) : $(OBJ)
#	$(CC) $(FLAG) $@  $^
#%.o : %.c
#	$(CC) $(CFLAG) $^
#.PHONY:clean
#clean:	
#	rm code
#

#编译c++文件
SRC = $(wildcard *cpp)
OBJ = $(SRC: .cpp=.o)
BIN = code
CPP = g++
NAME = -o
CFLAG = -c

$(BIN):$(OBJ)
	@$(CPP) $(NAME) $@ $^
	@echo "linking $^ to $@..."
%.o:%.cpp
	@$(CPP) $(CFLAG) $<
	@echo "compelling $@ to $<..."
.PHONY:clean
clean:
	rm $(BIN)  






